<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生界面</title>
    <script>
        function out1(){
            var name =document.cup.name.value;
            var names=/^[\u4e00-\u9fa5]+$/;
            if(name==""){
                alert("姓名不能为空!");
                return false;
            }

            if(!names.test(name)){
                alert("姓名应为中文");
                return false;
            }
            return true;

        }

        function out2(){
            var ber = document.cup.ber.value;
            var bers= /^[1][3,4,5,7,8][0-9]{9}$/;

            if(ber==""){
                alert("手机号码不能为空!");
                return false;
            }

            if (!bers.test(ber)){
                alert("手机号码格式错误！");
                return false;
            }
            return true;
        }

        function out3(){
            var mail = document.cup.mail.value;
            var mails= /\b\d{12}\b/;

            if(mail==""){
                alert("学号不能为空!");
                return false;
            }

            if(!mails.test(mail)){
                alert("学号格式错误");
                return false;
            }
            return true;
        }


        function out4(){
            var house  =document.cup.house.value;
            if(house==""){
                alert("年纪班级不能为空！");
                return false;
            }

            if(house.length >= 6){
                alert("年纪班级应小于6");
                return false;
            }
            return true;

        }


        function outs(){
            return out1()&&out2()&& out3()&&  out4();
            alert("注册成功")
        }

    </script>
    <link rel="stylesheet"href="/cell/demo.css">
</head>
<body >
<div id="login-box">
    <form name="cup"  onsubmit="return outs()"  method="post" action="demo2.html">
        <h1>学生注册界面</h1>
        <div class="form">
            <div class="item">
                <i class="fa fa-github-alt" style="font-size:24px"></i>
                姓名:<input type="text" name="name">
            </div>
            <div class="item">
                <i class="fa fa-github-alt" style="font-size:24px"></i>
                号码:<input type="text" name="ber" >
            </div>
            <div class="item">
                <i class="fa fa-github-alt" style="font-size:24px"></i>
                学号:<input type="text" name="mail"  >
            </div>
            <div class="item">
                <i class="fa fa-github-alt" style="font-size:24px"></i>
                年级班级:<input type="text" name="house" >
            </div>

            <div class="item">
                <i class="fa fa-github-alt" style="font-size:24px"></i>
                <input  type="submit" value="注册" >
            </div>

        </div>
    </form>


    <form  method="POST" action="demo2.html">
        <div class="form">
            <div class="item">
                <i class="fa fa-github-alt" style="font-size:24px"></i>
                <input type="submit" value="取消" >
            </div>
        </div>

    </form>
</div>

</body>
</html>